import 'package:flutter/material.dart';
import "package:get/get.dart";


 

  String? title;
  String? type;
  String? reason;
  String? status;
  
class ExaminePage extends StatefulWidget {
  const ExaminePage({super.key});

  @override
  State<ExaminePage> createState() => _SettingPageState();
}
  class _SettingPageState extends State<ExaminePage> {
  

    @override
    void initState() {
      super.initState();

     status= Get.parameters['status']; //0审核中 1通过 2驳回

    title = Get.parameters['title'];
   type = Get.parameters['type']; //1个人
   reason = Get.parameters['reason']; //0审核中 1通过 2驳回


    }

  @override
  Widget build(BuildContext context) {
    print(status);
    return Scaffold(
        body: 
        ListView(
          padding: EdgeInsets.only(top: 0),
          children: [
      Stack(
        children: [
          Container(
            child: Image.asset(
              type == '1'
                  ? 'static/images/gerenrenz.png'
                  : 'static/images/okguangfabg.png',
              fit: BoxFit.fitWidth,
            ),
          ),
          Positioned(
            left: 8.0,
            top: 20,
            child: IconButton(
              onPressed: () {
                // Get.offAllNamed('/');
                Get.back();
              },
              icon: Image.asset(
                'static/images/back.png',
                width: 22,
                fit: BoxFit.fitWidth,
              ),
            ),
          ),
        ],
      ),
      Container(
        height: 20,
        transform: Matrix4.translationValues(0.0, -10.0, 0.0),
        decoration: BoxDecoration(
            color: Color(0xffffffff), borderRadius: BorderRadius.circular(20)),
      ),
      status == '2' ? refuse() : info(type)
      //  info(),
      // refuse(),
      ,
      // Expanded(child: SizedBox()), // 用于推到底部
      status == '0'
          ? Align(
              child: Text(
                '审核中...',
                style: TextStyle(fontWeight: FontWeight.bold,fontSize: 18, color: Color.fromARGB(255, 40, 120, 255)),
              ),
            )
          : SizedBox(),
      SizedBox(height: 120),
    ]));
  }
}

Widget info(type) {
  return Column(
    children: [
      Align(
        child: Container(
            width: 100,
            height: 100,
            alignment: Alignment.center,
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(100),
                border: Border.all(color: Color(0xffcccccc))),
            child: Image.asset(
              type == '1'
                  ? 'static/images/xingqu.png'
                  : 'static/images/zuzhi.png',
              width: 50,
              fit: BoxFit.fitWidth,
            )),
      ),
      SizedBox(height: 20),
      
      Align(
        child:
         Text(
         status=='0'?
          '':
          '$title'
          ,
          style: TextStyle(fontSize: 16),
        ),
      ),
    ],
  );
}

Widget refuse() {
  return Align(
    child: Column(
      children: [
        Image.asset('static/images/weitongguo.png',
            width: 80, fit: BoxFit.fitWidth),
        Text(
          '您的认证申请未通过',
          style: TextStyle(fontSize: 16),
        ),
        SizedBox(
          height: 10,
        ),
        Text(
          '拒绝理由',
          style: TextStyle(fontSize: 12),
        ),
        SizedBox(
          height: 15,
        ),
        Container(
          margin: EdgeInsets.symmetric(horizontal: 30),
          child: Text(
            '$reason',
            style: TextStyle(fontSize: 12, color: Color(0xff999999)),
          ),
        ),
        GestureDetector(
          onTap: (){
            Get.toNamed('/identification?type=1');
          },
          child: Container(
          margin: EdgeInsets.only(top: 180,bottom: 15),
          width: 280,
          height: 50,
          alignment: Alignment.center,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular((25)),
            gradient: LinearGradient(
              colors: [
                Color(0xff2189E7),
                Color(0xffBF67F8),
              ], // 定义颜色列表
              begin: Alignment.topLeft, // 渐变开始的位置
              end: Alignment.bottomRight, // 渐变结束的位置
            ),
          ),
          child: Text('重新申请',style: TextStyle(fontSize: 16,color: Color(0XFFFFFFFF))),
        ),
        )
        
      ],
    ),
  );
}
